Date.prototype.format = function(b) {
	var c = {
		"M+": this.getMonth() + 1,
		"d+": this.getDate(),
		"h+": this.getHours(),
		"m+": this.getMinutes(),
		"s+": this.getSeconds(),
		"q+": Math.floor((this.getMonth() + 3) / 3),
		S: this.getMilliseconds()
	};
	if(/(y+)/.test(b)) {
		b = b.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length))
	}
	for(var a in c) {
		if(new RegExp("(" + a + ")").test(b)) {
			b = b.replace(RegExp.$1, RegExp.$1.length == 1 ? c[a] : ("00" + c[a]).substr(("" + c[a]).length))
		}
	}
	return b
};

function _gC(c) {
	var d = document.cookie.indexOf(c + "=");
	var a = d + c.length + 1;
	if((!d) && (c != document.cookie.substring(0, c.length))) {
		return null
	}
	if(d == -1) {
		return null
	}
	var b = document.cookie.indexOf(";", a);
	if(b == -1) {
		b = document.cookie.length
	}
	return unescape(document.cookie.substring(a, b))
}

function _gQ(a) {
	var b = new RegExp("(^|&)" + a + "=([^&]*)(&|$)", "i");
	var c = window.location.search.substr(1).match(b);
	if(c != null) {
		return unescape(c[2])
	}
	return null
}

function getU() {
	var d = _gQ("u");
	var a = new Date().format("MMddhhmm");
	var c = _gC("UNIONID");
	var b = document.referrer;
	if(b != null && b.length > 0) {
		b = encodeURI(b)
	}
	if(b != null && b.length > 3) {
		return b.replace("http://www.", "") + "(" + a + ")"
	} else {
		if(c == null || c.length == 0) {
			return b + "(" + a + ")"
		}
	}
	return null
}

function _sC() {
	var a = _gQ("u");
	var d = _gQ("kf");
	var b = _gQ("aid");
	var c = "?_r=" + Math.random();
	$.ajax({
		type: "get",
		async: true,
		url: "https://vip.niukewang.com/servlet/com.ksbd.services.getUnionJsonpAction",
		data: {
			key: "UNIONID"
		},
		dataType: "jsonp",
		jsonp: "jsonpCallback",
		success: function(l) {
			var e = l.data;
			if(!a && e == "" && location.href == "https://vip.niukewang.com/ksbd/?faq") {
				a = "faq"
			}
			var k = _gQ("UserName");
			if(!a && e == "" && k != null && k.length > 10) {
				a = "webapp"
			}
			if(a != null) {
				c += "&u=" + a
			}
			if(d != null) {
				c += "&kf=" + d
			}
			if(b != null) {
				c += "&aid=" + b
			}
			if(b != null || d != null || a != null) {
				var m = "https://vip.niukewang.com/servlet/com.ksbd.services.setUnionAction";
				m += c;
				if(a != null && a.length > 0) {
					var n = "UNIONID";
					var g = a;
					var j = 7;
					var i = document.domain;
					var h = new Date();
					h.setTime(h.getTime() + j * 24 * 3600 * 1000);
					var f = n + "=" + g + ";expires=" + h.toGMTString();
					if(i) {
						f += ";path=/;domain=" + i
					}
					document.cookie = f
				}
				$.ajax({
					type: "get",
					async: true,
					url: m,
					dataType: "jsonp",
					success: function() {}
				})
			}
		}
	})
}
_sC();